-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#4708] improvement(client-java/server): Add implementations for the getFileLocation
interface in Java Client / Server
#4858
Conversation
342fe36
to
839c2ed
Compare
18427c1
to
664ac5a
Compare
c9e386c
to
3fe438f
Compare
@jerryshao Hi, this PR is ready for review, please take a look when you have time, thanks. |
getFileLocation
interfaces in Java Client / ServergetFileLocation
interface in Java Client / Server
3fe438f
to
f3227ad
Compare
|
||
CallerContext callerContext = CallerContext.CallerContextHolder.get(); | ||
Map<String, String> queryParams = Maps.newHashMap(); | ||
queryParams.put("subPath", subPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe we should encoding the subPath to avoid supported chars in the URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
queryParams.put("subPath", subPath); | ||
FileLocationResponse resp = | ||
restClient.get( | ||
formatFilesetRequestPath(fullNamespace) + "/" + ident.name() + "/" + "fileLocation", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better to add the th subPath into the URL, not a queryParam?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I prefer to use the queryParams
for the following reasons:
- Currently other similar GET APIs pass parameters in the form of queryParams, like
RelationalTable.listPartitions()
; - I looked at the APIs of other commercial products, such as the REST API of Databricks' DBFS, and they also pass these parameters through queryParams: https://docs.databricks.com/api/workspace/dbfs/read;
- In the unit test, I tried to directly splice the URL, but it seems that the test framework cannot mock the request, so I guess some frameworks may not recognize the method of directly splicing parameters to the URL.
throw new UnsupportedOperationException("Not implemented"); | ||
// The constraints of the name spec may be more strict than underlying catalog, | ||
// and for compatibility reasons, we only apply case-sensitive capabilities here. | ||
return dispatcher.getFileLocation(normalizeCaseSensitive(ident), subPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest split the core part logic into another PR. In this PR, we only focus on client and server side API. Don't make the PR too big, which is hard to review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, this PR has been split to only include changes with the Java Client and Server.
659f7af
to
5edebdc
Compare
CallerContext callerContext = CallerContext.CallerContextHolder.get(); | ||
|
||
Map<String, String> params = new HashMap<>(); | ||
params.put("subPath", RESTUtils.encodeString(subPath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest we don't use camel style for param here "subPath" and path "fileLocation", how about "sub_path" and "location"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
ac84d2e
to
3b36e37
Compare
What changes were proposed in this pull request?
Add the implementations for
getFileLocation
interfaces in Java Client / Server.Why are the changes needed?
Fix: #4708
How was this patch tested?
Add some UTs and ITs.